import QtQuick
import QtQuick.Controls
import Gui.Components

Popup {
    id: root
    padding: 0
    readonly property real windowHeight: 400
    property alias tipWords: _listView.model
    signal itemClicked(string item)
    background: Rectangle {
        color: palette.base
    }
    contentItem: MListView {
        id: _listView
        delegate: Label {
            text: modelData
            width: ListView.view.width
            height: 40
            padding: 10
            background: Rectangle {
                color: _mouseArea.containsMouse ? Qt.alpha(palette.button, 0.5) : "transparent"
                MouseArea {
                    id: _mouseArea
                    anchors.fill: parent
                    hoverEnabled: true
                    onClicked: {
                        root.itemClicked(modelData);
                    }
                }
            }
        }
    }
    enter: Transition {
        NumberAnimation {
            properties: "height"
            easing.type: Easing.InOutQuad
            duration: 400
            from: 0
            to: root.windowHeight
        }
    }
    exit: Transition {
        NumberAnimation {
            properties: "height"
            easing.type: Easing.InOutQuad
            duration: 400
            from: root.windowHeight
            to: 0
        }
    }
}
